<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        

    </style>
</head>
<body>
    
    <script>
        // 鼠标按下时触发 onMousedown
        // document.body.addEventListener('mousedown', function(e) {
        //     console.log(e)
        // })
        // document.onmousedown = function(e){
        //     if(e.button === 0) {
        //         console.log('射击')
        //     } else if(e.button === 1){
        //         console.log('换枪')
        //     } else if(e.button === 2){
        //         console.log('开镜')
        //     }
        // }

        document.onkeydown = function(e){
            console.log(e.keyCode)
        }
    </script>
</body>
</html>